package com.iss.apartmentmanage.controller.check;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.iss.apartmentmanage.entity.RoomManage;
import com.iss.apartmentmanage.model.MyResponseData;
import com.iss.apartmentmanage.model.BaseModel;
import com.iss.apartmentmanage.service.impl.CheckServiceImpl;
import com.iss.apartmentmanage.utils.MyJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/check")
public class CheckinController {
    @Autowired
    CheckServiceImpl checkService;

    /**
     * 办理入住显示的房间状态为0（未入住），只显示当前登陆人员所在区的房间  管理人员全部显示
     * @param pageNum
     * @param pageSize
     * @param baseModel
     * @return
     */
    @RequestMapping(value = "/selectRoomForCheckIn",method = RequestMethod.POST)
    public String selectRoomForCheckIn(@RequestParam int pageNum, @RequestParam int pageSize,
                          @RequestBody BaseModel baseModel){
        MyResponseData myResponseData = new MyResponseData();
            IPage<RoomManage> iPage = checkService.selectRoomForCheckIn(pageNum,pageSize, baseModel);

            if(iPage!=null) {
                myResponseData.setObject(iPage);
                myResponseData.setErrorCode(1);
                myResponseData.setStatus("查询成功");
            }
            return MyJson.getJson(myResponseData);
    }


}
